<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateHostInfoTable extends Migration
{
    /**
     * 主播信息表
     */
    public function up(): void
    {
        Schema::create('host_info', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->default(0)->comment('主播ID');
            $table->integer('host_time')->default(0)->comment('成为主播时间');
            $table->integer('host_cancel_time')->default(0)->comment('取消主播时间');
            $table->integer('voice_answer_time')->default(0)->comment('语音接听时长');
            $table->integer('video_answer_time')->default(0)->comment('视频接听时长');
            $table->integer('voice_answer_num')->default(0)->comment('语音通话接听数');
            $table->integer('video_answer_num')->default(0)->comment('视频通话接听数');
            $table->timestamps();
            $table->tinyInteger('status')->default(1)->comment('记录状态：1-主播状态，0-非主播状态');
            $table->index('user_id', 'user_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('host_info');
    }
}
